#include<iostream>
#include<cstring>
using namespace std;
int n, m;
string a, b;
int main()
{
	cin >> n >> m;
	cin >> a >> b;
	string ans;
	for (int i = 0; i < n; i++) {
		if ((a[i] >= 'a' && a[i] <= 'z') || (a[i] >= 'A' && a[i] <= 'Z')) {
			ans += a[i];
		}
	}
	if (ans.find(b) != -1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}